package com.ftf.tp.blog.infrastructure.adapter.producer;

import com.ftf.tp.blog.application.adapter.producer.DomainEventPublisher;
import com.ftf.tp.blog.domain.article.event.BaseDomainEvent;
import com.ftf.tp.common.core.utils.SpringEventPublisher;
import org.springframework.stereotype.Component;


/**
 * @author tanghao
 * @date 2022/8/5
 */
@Component
public class DomainEventPublisherImpl implements DomainEventPublisher {

    /**
     * 发布事件
     *
     * @param event event
     */
    @Override
    public <EVENT extends BaseDomainEvent<?>> void publishBySpring(EVENT event) {
        SpringEventPublisher.publishEvent(event);
    }

    /**
     * 发布事件并保存
     *
     * @param event event
     */
    @Override
    public <EVENT extends BaseDomainEvent<?>> void publishAndSave(EVENT event) {

    }
}
